home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / compress / auto_501.lzh / DEPACK1.S < prev    next >
Text File  |  1985-11-20  |  3KB  |  180 lines

  1. ; A0 -> A0 depacker
  2. depack
  3. AU5_decrunch_2:
  4.     link    a3,#-120
  5.     movem.l    d0-a6,-(sp)
  6.     lea    120(a0),a4    
  7.     move.l    a4,a6        
  8.     bsr.s    .getinfo
  9.     cmpi.l    #'AU5!',d0    
  10.     bne    .not_packed
  11.     bsr.s    .getinfo    
  12.     lea.l    -8(a0,d0.l),a5    
  13.     bsr.s    .getinfo    
  14.     move.l    d0,(sp)        
  15.     adda.l    d0,a6        
  16.     move.l    a6,a1
  17.  
  18.     moveq    #119,d0        
  19. .save:    move.b    -(a1),-(a3)    
  20.     dbf    d0,.save
  21.     move.l    a6,a3        
  22.     move.b    -(a5),d7    
  23.     bsr.s    .normal_bytes
  24.     move.l    a3,a5        
  25.  
  26.     bsr.s    .get_1_bit    
  27.     bcc.s    .no_picture    
  28.     move.w    #$0f9f,d7     
  29. .AU5_00:
  30.     moveq    #3,d6    
  31. .AU5_01:
  32.     move.w    -(a3),d4
  33.     moveq    #3,d5        
  34. .AU5_02:
  35.     add.w    d4,d4    
  36.     addx.w    d0,d0        
  37.     add.w    d4,d4        
  38.     addx.w    d1,d1        
  39.     add.w    d4,d4        
  40.     addx.w    d2,d2        
  41.     add.w    d4,d4        
  42.     addx.w    d3,d3        
  43.     dbra    d5,.AU5_02    
  44.     dbra    d6,.AU5_01    
  45.     movem.w    d0-d3,(a3)    
  46.     dbra    d7,.AU5_00    
  47. .no_picture
  48.     movem.l    (sp),d0-a3    
  49.  
  50. .move    move.b    (a4)+,(a0)+
  51.     subq.l    #1,d0
  52.     bne.s    .move
  53.     moveq    #119,d0        
  54. .rest    move.b    -(a3),-(a5)    
  55.     dbf    d0,.rest
  56. .not_packed:
  57.     movem.l    (sp)+,d0-a6
  58.     unlk    a3
  59.     rts
  60. .getinfo: 
  61.     moveq    #3,d1        
  62. .getbytes:
  63.     lsl.l    #8,d0    
  64.     move.b    (a0)+,d0
  65.     dbf    d1,.getbytes
  66.     rts
  67. .normal_bytes:    
  68.     bsr.s    .get_1_bit
  69.     bcc.s    .test_if_end    
  70.     moveq.l    #0,d1        
  71.     bsr.s    .get_1_bit
  72.     bcc.s    .copy_direkt    
  73.     lea.l    .direkt_tab+20(pc),a1
  74.     moveq.l    #4,d3
  75. .nextgb:
  76.     move.l    -(a1),d0
  77.     bsr.s    .get_d0_bits
  78.     swap.w    d0
  79.     cmp.w    d0,d1        
  80.     dbne    d3,.nextgb    
  81. .no_more: 
  82.     add.l    20(a1),d1     
  83. .copy_direkt:    
  84.     move.b    -(a5),-(a6)    
  85.     dbf    d1,.copy_direkt    
  86. .test_if_end:    
  87.     cmpa.l    a4,a6        
  88.     bgt.s    .strings    
  89.     rts    
  90.  
  91. .get_1_bit:
  92.     add.b    d7,d7        
  93.     bne.s    .bitfound     
  94.     move.b    -(a5),d7    
  95.     addx.b    d7,d7
  96. .bitfound:
  97.     rts    
  98.  
  99. .get_d0_bits:    
  100.     moveq.l    #0,d1        
  101. .hole_bit_loop:    
  102.     add.b    d7,d7        
  103.     bne.s    .on_d0        
  104.     move.b    -(a5),d7    
  105.     addx.b    d7,d7
  106. .on_d0:    addx.w    d1,d1        
  107.     dbf    d0,.hole_bit_loop    
  108.     rts    
  109.  
  110. .strings: 
  111.     lea.l    .length_tab(pc),a1    
  112.     moveq.l    #3,d2        
  113. .get_length_bit:    
  114.     bsr.s    .get_1_bit
  115.     dbcc    d2,.get_length_bit
  116. .no_length_bit:    
  117.     moveq.l    #0,d4        
  118.     moveq.l    #0,d1
  119.     move.b    1(a1,d2.w),d0    
  120.     ext.w    d0        
  121.     bmi.s    .no_über    
  122. .get_über:
  123.     bsr.s    .get_d0_bits
  124. .no_über:
  125.     move.b    6(a1,d2.w),d4
  126.     add.w    d1,d4    
  127.     beq.s    .get_offset_2    
  128.  
  129.     lea.l    .more_offset(pc),a1 
  130.     moveq.l    #1,d2
  131. .getoffs: 
  132.     bsr.s    .get_1_bit
  133.     dbcc    d2,.getoffs
  134.     moveq.l    #0,d1        
  135.     move.b    1(a1,d2.w),d0    
  136.     ext.w    d0        
  137.     bsr.s    .get_d0_bits
  138.     add.w    d2,d2        
  139.     add.w    6(a1,d2.w),d1    
  140.     bpl.s    .depack_bytes    
  141.     sub.w    d4,d1        
  142.     bra.s    .depack_bytes
  143.  
  144.  
  145. .get_offset_2:    
  146.     moveq.l    #0,d1        
  147.     moveq.l    #5,d0        
  148.     moveq.l    #-1,d2        
  149.     bsr.s    .get_1_bit
  150.     bcc.s    .less_40    
  151.     moveq.l    #8,d0        
  152.     moveq.l    #$3f,d2        
  153. .less_40: 
  154.     bsr.s    .get_d0_bits
  155.     add.w    d2,d1        
  156.  
  157. .depack_bytes:            
  158.     lea.l    2(a6,d4.w),a1    
  159.     adda.w    d1,a1        
  160.     move.b    -(a1),-(a6)    
  161. .dep_b:    move.b    -(a1),-(a6)    
  162.     dbf    d4,.dep_b     
  163.     bra    .normal_bytes    
  164.  
  165.  
  166. .direkt_tab:
  167.     dc.l $7fff000e,$00ff0007,$00070002,$00030001,$00030001    
  168.     dc.l 270-1,15-1,8-1,5-1,2-1    
  169.  
  170. .length_tab:
  171.     dc.b 9,1,0,-1,-1    
  172.     dc.b 8,4,2,1,0        
  173.  
  174. .more_offset:
  175.     dc.b      11,   4,   7,  0    
  176.     dc.w    $11f,  -1, $1f    
  177.  
  178. ende_AU5_decrunch_2:
  179. ;*************************************************** Ende der Unpackroutine
  180.